Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(macOS): release ns_submenu, ns_menu_item manually #122

Merged
merged 5 commits into from
Sep 18, 2023

Conversation

pewsheen
Copy link
Contributor

Issue: tauri-apps/tauri#7828

The ns_submenu will be manually released when NsMenuRef dropped.

impl Drop for NsMenuRef {
fn drop(&mut self) {
unsafe {
let _: () = msg_send![self.1, removeAllItems];
let _: () = msg_send![self.1, release];
}
}
}

Copy link
Member

@amrbashir amrbashir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also remove autorelease from all ns menu items as well and release them manually in the drop handler?

@pewsheen
Copy link
Contributor Author

Could we also remove autorelease from all ns menu items as well and release them manually in the drop handler?

Perhaps we could follow how NsMenuRef did and make a NsMenuItemRef and implement Drop trait for it

@amrbashir
Copy link
Member

Yeah sure, sounds good

@pewsheen pewsheen changed the title fix(macOS): remove autorelease from ns_submenu to avoid over release fix(macOS): release ns_submenu, ns_menu_item manually Sep 14, 2023
@amrbashir amrbashir merged commit bdd0c9a into tauri-apps:dev Sep 18, 2023
6 checks passed
@pewsheen pewsheen deleted the submenu-release branch October 25, 2024 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants